import Mock from 'mockjs'

// const List = []
// const count = 100

let List = Mock.mock({
  'tags|1-5': [
    {
      'name|+1': ['a', 'b', 'c'],
      'id|+1': ['11', '22', '33', '44', '55'],
      'position|+1': [
        [1, 2, 1],
        [2, 3, 1],
        [0, 0, 1],
        [-5, 5, 1]
      ]
    }
  ]
})

export default [
  {
    url: '/getTagPosition',
    type: 'get',
    response: config => {
      let mockList = List.tags
      console.log(config)
      return {
        code: 0,
        data: {
          tags:mockList
        }
      }
    }
  },

  {
    url: '/vue-element-admin/article/detail',
    type: 'get',
    response: config => {
      const { id } = config.query
      for (const article of List) {
        if (article.id === +id) {
          return {
            code: 20000,
            data: article
          }
        }
      }
    }
  },

  {
    url: '/vue-element-admin/article/pv',
    type: 'get',
    response: _ => {
      return {
        code: 20000,
        data: {
          pvData: [
            { key: 'PC', pv: 1024 },
            { key: 'mobile', pv: 1024 },
            { key: 'ios', pv: 1024 },
            { key: 'android', pv: 1024 }
          ]
        }
      }
    }
  },

  {
    url: '/vue-element-admin/article/create',
    type: 'post',
    response: _ => {
      return {
        code: 20000,
        data: 'success'
      }
    }
  },

  {
    url: '/vue-element-admin/article/update',
    type: 'post',
    response: _ => {
      return {
        code: 20000,
        data: 'success'
      }
    }
  }
]
